/**
 * @file cstart.c
 * @author lcz (you@domain.com)
 * @brief
 * @version 0.1
 * @date 2022-11-02
 *
 * @copyright Copyright (c) 2022
 *
 */

#include <stdint.h>
#include "applib/lib_syscall.h" 
#include <stdlib.h>
int main(int argc, char **argv);
/**
 * @brief 应用的初始化，C部分
 */
void cstart(int argc, char **argv)
{
    // 清空bss区，注意这是必须的！！！
    // 像newlib库中有些代码就依赖于此，未清空时数据未知，导致调用sbrk时申请很大内存空间

    extern uint8_t __bss_start__[], __bss_end__[];
    uint8_t * start = __bss_start__;
    while (start<__bss_end__)
    {
        *start++;
    }

    exit(main(argc, argv));
}
